<?php
/**
 * Created by PhpStorm.
 * User: leon_home
 * Date: 2017/8/12
 * Time: 9:08
 */

namespace Admin\Controller;


use Think\Controller;

class MailController extends Controller {
	public function setting(){
		if(IS_AJAX){
			$config = M('System');
			$data['value'] = serialize(I('post.'));
			$res = $config->where(['name'=>'mail'])->save($data);
			if($res){
				
				$this->ajaxReturn(['info'=>'配置成功','status'=>1,'url'=>U('System/siteConfig')]);
			}else{
				$this->ajaxReturn(['info'=>'配置失败','status'=>0,'url'=>U('System/siteConfig')]);
			}
		}else{
			$config = M('System');
			$res = $config->where(['name'=>'mail'])->find();
			$data = unserialize($res['value']);
			$this->assign('mail',$data);
			$this->display();
		}
	}
}